package model

import (
	"go.mongodb.org/mongo-driver/bson/primitive"
)

// 部门模型
type Department struct {
	// ID
	ID primitive.ObjectID `json:"id" bson:"ID"`
	// Parent Department ID
	ParentID string `json:"parentId" bson:"ParentID" validate:"required"`
	// 祖级列表
	Ancestors	[]string	`json:"ancestors" bson:"Ancestors"`
	// Name
	Name string	`json:"name" bson:"Name" validate:"required"`
	// Administrator ID
	AdminID string	`json:"adminId" bson:"AdminID"`
	// Administrator Name (won't store in db)
	AdminName string	`json:"adminName" bson:"-"`

	TenantModel	`json:",inline" bson:",inline"`
}

func (d *Department) GetId() string {
	return d.ID.Hex()
}

func (d *Department) SetId(id primitive.ObjectID) {
	d.ID = id
}
